package com.admin;








import java.io.File;
import java.io.UnsupportedEncodingException;
import java.security.Security;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Random;

import javax.mail.Address;
import javax.mail.Authenticator;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

import org.apache.ibatis.session.SqlSession;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.Constants;
import com.admin.UserAction;
import com.bg.Zhsq;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.util.Emailconfig;
import com.util.MD5Encryption;








public class UserAction extends UserService {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 7546715529240329195L;
	private User user;
	private String usercode;
	private String password;
	private String username;
	private String newpassword;
	private String roleid;
	private String forbidden;
	private List<User> users;
	private String comid;
	private String mrrole;
	private String createuserid;
	private int resutPassword;
	private String userid;
	private String Xgzd;
	private String Value;
	private String array;
	private int page;
	private int limit;
	private File file;
	private static String table ="\"User\"";
	private int RoleID; 
	private List<Company> coms;
	private List<Role> roles;
	private String Comids;
	private String Roleids;
	private String userids;
	private int Forbi;
	private int Type;
	private int UserId;
	private int xzwjlx;
	
	private List<Zhsq> zhsqs;
	
	
	private int menuid;
	private String limits;
	private String email;
	private int deptid;
	
	
	private int id;
	private int jg;
	
	public int getDeptid() {
		return deptid;
	}


	public void setDeptid(int deptid) {
		this.deptid = deptid;
	}


	public String execute() {
		
			User loginuser = (User)session.get(Constants.USER);
			if(loginuser!=null) {
				
				return "success";
			}else {
				return "error";
			}
			
	}
	
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public void shsqsj() {
		User loginuser = (User)session.get(Constants.USER);
		Map map=new HashMap();
		map.put("password", password);
		map.put("id", id);
		map.put("jg", jg);
		map.put("shruserid", loginuser.getUserid());
		map.put("usercode", usercode);
		map.put("email", email);
		SqlSession sqlSession = getSqlSession();
		try {   
			UserMapper sqxxmp=sqlSession.getMapper(UserMapper.class);
			 sqxxmp.shsqsj(map);
			 
			 if(usercode!=null && usercode!="") {
			
		    		  
			 Emailconfig config = sqxxmp.getconfig();
				 
				 
			 Thread t = new Thread(){
				 public void run(){
					 
					 Zhsq ls_zhsq = new Zhsq();
					 ls_zhsq.setEmail(email);
					 ls_zhsq.setId(id);
					 ls_zhsq.setPassword(password);
					 ls_zhsq.setUsercode(usercode);
					 emailsend(ls_zhsq,config);
		            }
		        };
		        t.start();
		     }
		}finally {
	    	
			sqlSession.close();
		}
		ajaxJson("success");
	}
	
	
	
	
	private void emailsend(Zhsq ls_zhsq,Emailconfig config) {
		
		Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
        final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
		// 谁发送(发送方)
        String from = config.getFrom();
        
        // 发给谁
        String to = ls_zhsq.getEmail();
        
        // 发送者的用户名和密码(邮箱登录用)
        final String username = config.getUsername(); // 此处填写发送的邮箱名
        final String password = config.getPassword(); // 此处填写登录的邮箱密码
 
//        // 定义properties对象，设置环境信息
//        Properties properties = new Properties();
//        
//        /*
//         * mail.smtp.host ：指定连接的邮件服务器的主机名。如：163邮箱就填写smtp.163.com 
//         * 若在本地测试的话，需要在本地安装smtp服务器
//         */
//        properties.setProperty("mail.smtp.host", config.getSmtphost());
//        
//        // mail.smtp.auth：指定客户端是否要向邮件服务器提交验证
//        properties.setProperty("mail.smtp.auth",config.getSmtphost());
//        
//        /*
//         * mail.transport.protocol：指定邮件发送协议：smtp。smtp：发邮件；pop3：收邮件
//         * mail.store.protocol:指定邮件接收协议
//         */
//        properties.setProperty("mail.transport.protocol", config.getStoreprotocol());
//        
//        properties.setProperty("mail.smtp.socketFactory.class", SSL_FACTORY);
//        properties.setProperty("mail.smtp.socketFactory.fallback", "false");
//        //邮箱发送服务器端口,这里设置为 587 端口
//        properties.setProperty("mail.smtp.port", "587");
//        properties.setProperty("mail.smtp.socketFactory.port", "587");

        
        
        Properties props = new Properties();
         props.setProperty("mail.smtp.host", config.getSmtphost());
         props.setProperty("mail.smtp.socketFactory.class", SSL_FACTORY);
         props.setProperty("mail.smtp.socketFactory.fallback", "false");
         props.setProperty("mail.smtp.port", config.getPort());
         props.setProperty("mail.smtp.socketFactory.port", config.getPort());
         props.put("mail.smtp.auth", "true");
        
         
         Session session = Session.getDefaultInstance(props, new Authenticator() {
             protected PasswordAuthentication getPasswordAuthentication() {
                 return new PasswordAuthentication(username, password);
             }
          });
         
        // 获取session对象
       // Session session = Session.getInstance(properties);
        
        // 当设置为true，JavaMail AP就会将其运行过程和邮件服务器的交互命令信息输出到console中，用于JavaMail的调试
        session.setDebug(true);
        try {
            
            // 创建邮件对象
            MimeMessage message = new MimeMessage(session);
            
            // 设置邮件发送方
            message.setFrom(new InternetAddress(username,from));
            
            // 设置邮件发送的主题<邮件标题>
            //message.setSubject("审核通过提醒");
            //String  msg = "您的审核通过，账号为：" +ls_zhsq.getUsercode() + "密码未：" +ls_zhsq.getPassword();
            
            message.setSubject("审核情况");
            String  msg="";
            if(ls_zhsq.getPassword()!=null) {
            	
            	
            	msg  = "<font style='font-family:\"宋体\";' size = '4'  >尊敬的平台用户：</font><br/><font style='font-family:\"宋体\";' size = '4' >&nbsp;&nbsp;您好！</font><br/><font style='font-family:\"宋体\";' size = '4'  >&nbsp;&nbsp;您申请的智询-已上市药品变更管理决策支持系统账号已通过审核，账号信息如下：</font><br/>";
                 msg = msg + "<font style='font-weight: bold;font-family:\"宋体\";' size = '4' >&nbsp;&nbsp;账号："+ls_zhsq.getUsercode()+"</font><br/>";
                 msg = msg + "<font style='font-weight: bold;font-family:\"宋体\";' size = '4'  >&nbsp;&nbsp;密码："+ls_zhsq.getPassword()+"</font><br/>";
                 msg = msg + "<font style='font-family:\"宋体\";' size = '4' >&nbsp;&nbsp;请及时更改并妥善保管您的账号及密码。</font><br/>";
                 msg = msg + "<br/><font style='font-family:\"宋体\";'  size = '4'>&nbsp;&nbsp;系统邮件，请勿回复。</font><br/>";
                 msg = msg + "<hr />";
                 msg = msg + "<font style='font-weight: bold;font-family:\"宋体\";' size = '4' >&nbsp;&nbsp;浙江省药品化妆品审评中心</font>";
               
            }else {
            
            msg = "<font style='font-family:\"宋体\";' size = '4'  >尊敬的平台用户：</font><br/><font style='font-family:\"宋体\";' size = '4' >&nbsp;&nbsp;您好！</font><br/><font style='font-family:\"宋体\";' size = '4'  >&nbsp;&nbsp;您申请的智询-已上市药品变更管理决策支持系统账号未通过审核，理由如下：</font><br/>";
            msg = msg + "<font style='font-weight: bold;font-family:\"宋体\";' size = '4' >&nbsp;&nbsp;"+ls_zhsq.getUsercode()+"</font><br/>";
            msg = msg + "<font style='font-family:\"宋体\";' size = '4' >&nbsp;&nbsp;给您带来不便，请见谅！</font><br/>";
            msg = msg + "<br/><font style='font-family:\"宋体\";'  size = '4'>&nbsp;&nbsp;系统邮件，请勿回复。</font><br/>";
            msg = msg + "<hr />";
            msg = msg + "<font style='font-weight: bold;font-family:\"宋体\";' size = '4' >&nbsp;&nbsp;浙江省药品化妆品审评中心</font>";
           
            }
            
            
            // 设置邮件发送的内容
            message.setContent(msg,"text/html;charset=utf-8");
            //Transport transport=session.getTransport();
            message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to, false));
            //message.setRecipients(Message.RecipientType.CC, InternetAddress.parse(to, false));
           // message.setRecipients(Message.RecipientType.BCC, InternetAddress.parse(to, false));

            // 连接邮件服务器，“”中填写邮件服务器主机名
           // transport.connect(config.getSmtphost(),25, username, password);
          //  transport.sendMessage(message,new Address[]{new InternetAddress(to)});
            Transport.send(message);
            //transport.close();
            saveemaillog("发送成功",ls_zhsq);
            return;
        } catch (MessagingException | UnsupportedEncodingException e) {
            e.printStackTrace();
            saveemaillog(e.getMessage(),ls_zhsq);
            return;
        }
	}
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public void saveemaillog(String msg,Zhsq ls_zhsq) {
		Map map=new HashMap();
		map.put("id", ls_zhsq.getId());
		map.put("msg", msg);
		
		SqlSession sqlSession = getSqlSession();
		try {   
			UserMapper sqxxmp=sqlSession.getMapper(UserMapper.class);
			 sqxxmp.saveemaillog(map);
			
         }finally {
	    	
			sqlSession.close();
		}
		
	}
	
	
	
	@SuppressWarnings({ "unchecked", "rawtypes" })
	public void getsqxx() {
		
		Map map=new HashMap();
		map.put("zt", xzwjlx);
		SqlSession sqlSession = getSqlSession();
		try {   
			UserMapper sqxxmp=sqlSession.getMapper(UserMapper.class);
			zhsqs = sqxxmp.getsqxx(map);
		}finally {
	    	
			sqlSession.close();
		}
		ajaxJson(zhsqs);
		
	}
	
	
	@SuppressWarnings({ "unchecked", "rawtypes" })
	public void changeuserForbidden() {
		Map map=new HashMap();
		map.put("Forbidden", Forbi);
		map.put("Userids", userids);
		SqlSession sqlSession = getSqlSession();
		try {   
			UserMapper rolemp=sqlSession.getMapper(UserMapper.class);
			rolemp.changeuserForbidden(map);
		}finally {
	    	
			sqlSession.close();
		}
		ajaxJson("SUCCESS");
	}
	
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public void czpw() {
	SqlSession sqlSession = getSqlSession();
	try {
		UserMapper rolemp=sqlSession.getMapper(UserMapper.class);
		newpassword = getRandomString(8);
		String passwd = MD5Encryption.toMD5(newpassword);
		Map map=new HashMap();
		map.put("Password", passwd);
		map.put("Userid", UserId);
		rolemp.czpw(map);
		
	}finally {
    	
		sqlSession.close();
	}
	ajaxJson(newpassword);
	}
	
	
	public void newuser() {
	User loginuser = (User)session.get(Constants.USER);
    SqlSession sqlSession = getSqlSession(false);
    int a=0;
    int b=0;
	try {
			UserMapper rolemp=sqlSession.getMapper(UserMapper.class);
			User newuser = new User();
			
			newpassword = getRandomString(8);
			String passwd = MD5Encryption.toMD5(newpassword);
			newuser.setRoleids(RoleID);
			newuser.setCreateuserid(loginuser.getUserid());
			newuser.setPassword(passwd);
			newuser.setUsercode(usercode);
			newuser.setUsername(username);
			a = rolemp.saveuser(newuser);
			if(a==1) {
			b = rolemp.saveuser_role(newuser);
			}
			if(b == 1) {
				 ajaxJson(newpassword,0);
				
			}else {
				
				ajaxJson("数据异常，操作失败",300);
				
			}
			sqlSession.commit();
	  }catch(Exception e) {
		  sqlSession.rollback();
		  ajaxJson(e.getMessage(),300);
	    }finally {
	    	
			sqlSession.close();
		}	
	}
	
	private  String getRandomString(int length){
	     String str="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
	     Random random=new Random();
	     StringBuffer sb=new StringBuffer();
	     for(int i=0;i<length;i++){
	       int number=random.nextInt(62);
	       sb.append(str.charAt(number));
	     }
	     return sb.toString();
	 }
	
	public void showusers() {
		
		SqlSession sqlSession = getSqlSession();
		
		
		try {
			UserMapper rolemp=sqlSession.getMapper(UserMapper.class);
			users=rolemp.showusersbysql();
		
		} finally {
			sqlSession.close();
		}	
		
		ajaxJsonTable(users);
	}
	
	
	
	
	
	
	
	public String moduserqx() {
		
		
		return "success";
	}
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public void saveumlimit() {
		Map map=new HashMap();
		map.put("table", "\"User_Menu_Limit\"");
		map.put("where", "\"Userid\"="+userid+" and \"Menuid\"="+menuid);
	    deletetable(map);
	    if(!limits.equals("")) {
	    String[]  a=limits.split(",");
	    String zdm="\"Userid\",\"Menuid\",\"Limitlevel\"";
	    
	    for(int t=0;t<a.length;t++) {
	    String nr=userid+","+menuid;
	    nr+=","+a[t];
	    map.put("zdm", zdm);		
	    map.put("nr", nr);	
	    inserttable(map);
	    }
	    
	    }
	    savelog("操作成功");
	    ajaxJson("保存成功!");
	}
	
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public void dotoshowdict() {
		Map map=new HashMap();
		map.put("table", "\"Dictionary\"");
		map.put("where", "\"Type\"="+Type+" and \"Comid\"="+comid);
		map.put("nr", "*");
		map.put("px", "\"Value\"");
		List<LinkedHashMap<String, String>>	list =selecttable(map);
		ajaxJson(list);
		}
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public void doshoumlimit() {
		Map map=new HashMap();
		map.put("table", "\"User_Menu_Limit\" a");
		map.put("jointable", " join \"Dictionary\" b on a.\"Limitlevel\"=b.\"Value\" and b.\"Type\"=1");
		map.put("where", " \"Menuid\"="+menuid+" and  \"Userid\"="+userid);
		map.put("nr", "a.*,b.\"Name\"");
		map.put("px", "\"Limitlevel\"");
		List<LinkedHashMap<String, String>>	list =selecttable(map);
		ajaxJson(list);
		
		
		
		
	}
	
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public String owner() {
		User loginuser = (User)session.get(Constants.USER);
		Company company=(Company)session.get(Constants.USER_COMPANYS);
		Map map=new HashMap();
		map.put("where", "\"Userid\"="+loginuser.getUserid());
		coms=selectcomsbysql(map);
		map.put("where", "\"Userid\"="+loginuser.getUserid()+" and \"Comid\"="+company.getComid());
		roles=selectrolesbysql(map);
		return "success";
	}
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public void selectRole() {
		User loginuser = (User)session.get(Constants.USER);
		Map map=new HashMap();
		map.put("where", "\"Userid\"="+loginuser.getUserid()+" and \"Comid\"="+comid);
		roles=selectrolesbysql(map);
		ajaxJson(roles);
	}
	
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public void changeRoleid() {
		
		try {
		User loginuser = (User)session.get(Constants.USER);
		Map params = new HashMap();
		params.put("table", "\"User_Role\"");	
		params.put("Xgzd", "Checked");
		params.put("Value", "0");
		params.put("Keyid", "Userid");
		params.put("Keyidvalue", loginuser.getUserid());
		updatetablebykey(params);
		params.put("nr", "\"Checked\"=1");
		params.put("where", "\"Userid\"="+loginuser.getUserid()+" and \"Roleid\"="+roleid);
		updatetablebywhere(params);
		savelog("操作成功");
		}catch(Exception e) {
			savelog("操作失败");
			
		}
		ajaxJson("success");
	}
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public void changeComid(){
		try {
			User loginuser = (User)session.get(Constants.USER);
		Map params = new HashMap();
		params.put("table", "\"User_Company\"");	
		params.put("Xgzd", "Checked");
		params.put("Value", "0");
		params.put("Keyid", "Userid");
		params.put("Keyidvalue", loginuser.getUserid());
		updatetablebykey(params);
		params.put("nr", "\"Checked\"=1");
		params.put("where", "\"Userid\"="+loginuser.getUserid()+" and \"Comid\"="+comid);
		updatetablebywhere(params);
		savelog("操作成功");
		}catch(Exception e) {
			savelog("操作失败");
			
		}
		ajaxJson("success");
	}
	
	//修改用户密码
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public void passwordmod(){
		String oldpwd;
		String passwd =MD5Encryption.toMD5(password);//用户输入的旧密码
		String passnew=MD5Encryption.toMD5(newpassword);//用户输入的新密码
		oldpwd = selectpasswordByUsercode(usercode);//原密码
		Map map = new HashMap();
		map.put("Password", passnew);
		map.put("Usercode", usercode);
		if(oldpwd.equals(passwd)){
			int result = updatepassword(map);
			if(result==0){
				message="修改失败,数据库保存失败!";
				}else{
				message="修改成功!";
			}
		}else{
			message = "你输入的原密码不匹配,请重新输入!";
		}
		
		ajaxJson(message);
	}

	//显示用户表格
	@SuppressWarnings({"rawtypes", "unchecked" })
	public String showuserstables(){
		
		Map params = new HashMap();
		int min = (page-1)*limit+1;
		int max = limit*page;
		String tj = "rownumber between "+min+" and "+max;
		String like="1=1";
		if(username!=null){
			if(!username.equals("")){
				like+="and \"Username\" like  '%"+username+"%'";
			}
		}
		
		params.put("table", table);
		params.put("fybetween", tj);
		params.put("like", like);
		params.put("nr"," \"Userid\",\"Username\",\"Usercode\",\"Forbidden\",string_agg(\"Comname\", ',') AS \"Comnames\",\"Rolenames\" ");
		params.put("px","\"Userid\" desc");
		                      
		if(roleid.equals(1)){
			String where = "1=1";
			params.put("where", where);
		}else{
			String jointable = " join \"Role_Company\" on \"Role_Company\".\"Roleid\"=\"'+Roleid+'\"join\"User_Company\" on \"User_Company\".\"Comid\"=\"Role_Company\".\"Comid\" "; 
			String where = "\"User_Company\".\"Checked\"=1";
			
			params.put("jointable", jointable);
			params.put("where", where);
		}
		
		List<LinkedHashMap<String,String>> list = getlist(params);
		if(list.size()>0){
			String strs = gson.toJson(list.get(0));
			JsonParser parser = new JsonParser();
			JsonElement jsonEl = parser.parse(strs);
			JsonObject jsonObj = null;
			jsonObj = jsonEl.getAsJsonObject();//转换成Json对象
			String number=jsonObj.get("Count").getAsString();//status节点
			ajaxJsontablefy(number,list);
		}else{
			ajaxJsontablefy("0",null);
		}
		return null;
	}
	
	//自定义显示用户表111
	/*
	 * @SuppressWarnings({ "rawtypes", "unchecked" }) public void
	 * showuserstablesss(){ String like=" 1=1 "; String tj="1=1"; String tj2=""; int
	 * Comid=0; if(!roleid.equals("1")) { Company com =
	 * (Company)session.get(Constants.USER_COMPANYS); Comid=com.getComid();
	 * tj2+="and e.\"Comid\" in ("+Comid+")"; } Map map = new HashMap();
	 * map.put("Roleid", roleid); map.put("like", like+tj2); map.put("tj", tj);
	 * users = selectusertable(map); List<String> list=com.WebSocketTest.userids;
	 * for(int a=0;a<users.size();a++) { if
	 * (list.contains(users.get(a).getUserid()+"")) { users.get(a).setOnline(1); } }
	 * String number=getalluser(Comid,like+tj2).size()+"";
	 * ajaxJsontableclassfy(number,users); }
	 */
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public void showuserstablesss(){
		Company coms = (Company)session.get(Constants.USER_COMPANYS);
		String where=" (d.\"Checked\"=1 or d.\"Checked\" is null)";
		if(!roleid.equals("1")) {
			where+=" and d.\"Comid\" ="+coms.getComid()+"";
		}
		Map map = new HashMap();
		map.put("where", where);
		users = selectusertable(map);
		List<String> list=com.WebSocketTest.userids;
		for(int a=0;a<users.size();a++) {
			if (list.contains(users.get(a).getUserid()+"")) {
				users.get(a).setOnline(1);
				} 
		}
		
		ajaxJsontable(users);
	}
	
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public void selectuserbycode(){
		String where="a.\"Usercode\"='"+user.getUsercode()+"'";
		
		Map map = new HashMap();
		map.put("where", where);
		users = selectusertable(map);
		
		ajaxJsontable(users);
	}
	
	
	//自定义显示用户表
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public void showuserstabless(){
		String like=" 1=1 ";
		if(username!=null){
			if(!username.equals("")){
				like+="and a.\"Username\" like  '%"+username+"%'";
			}
		}
		if(usercode!=null){
			if(!usercode.equals("")){
				like+="and a.\"Usercode\" like  '%"+usercode+"%'";
			}
		}
		if(forbidden!=null&&!forbidden.equals("")){
			if(forbidden.indexOf(",")==-1){
				like+="and a.\"Forbidden\" = "+forbidden;
			}
			
		}else {
			
			like+="and a.\"Forbidden\" = "+0;	
		}
		if(Roleids!=null&&!Roleids.equals("")){
			
			like+="and c.\"Roleid\" in ("+Roleids+")";
		}
		int min = (page-1)*limit+1;
		int max = limit*page;
		String tj = "a.\"Unumber\" between "+min+" and "+max;
		String tj2="";
		int Comid=0;	
		if(!roleid.equals("1")) {
			Company com = (Company)session.get(Constants.USER_COMPANYS);
			
			Comid=com.getComid();
			tj2+="and e.\"Comid\" in ("+Comid+")";
			
		}else if(Comids!=null&&!Comids.equals("")){
			
			tj2+="and e.\"Comid\" in ("+Comids+")";
		}
		Map map = new HashMap();
		map.put("Roleid", roleid);
		map.put("like", like+tj2);
		map.put("tj", tj);
		users = selectusertable(map);
		List<String> list=com.WebSocketTest.userids;
		for(int a=0;a<users.size();a++) {
			
			if (list.contains(users.get(a).getUserid()+"")) {
				 
				users.get(a).setOnline(1);
				 
				} 
		}
		
		String number=getalluser(Comid,like+tj2).size()+"";
		ajaxJsontableclassfy(number,users);
	}
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public void usernew(){
		
		String zdm1 = "\"Usercode\",\"Password\",\"Username\"";
		String nr1  = "'"+usercode+"','"+MD5Encryption.toMD5(password)+"','"+username+"'";
		Map map1 = new HashMap();
		map1.put("table", "\"User\"");
		map1.put("zdm",zdm1);
		map1.put("nr", nr1);
		message=inserttable(map1);
		if(message.equals("")) {
			message="新增成功！";
		}else {
			message="新增失败！";
		}
		savelog(message);
		ajaxJson(message);
	}
	
	
	
	//新增用户
	@SuppressWarnings({ "unchecked", "rawtypes",})
	public void saveusernew(){
		if(password!=null||username!=null){	//用于判断是否为编辑用户时 进入该方法
			//1.添加用户表  账号 密码 名称
			String zdm1 = "\"Usercode\",\"Password\",\"Username\"";
			String nr1  = "'"+usercode+"','"+MD5Encryption.toMD5(password)+"','"+username+"'";
			Map map1 = new HashMap();
			map1.put("table", "\"User\"");
			map1.put("zdm",zdm1);
			map1.put("nr", nr1);
			inserttable(map1);
		}
		
		
		if(userid==null) {
			Map map2 = new HashMap();
			map2.put("Usercode",usercode);
			userid=selectUseridByUsercode(map2);//查询用户id
		}
		//2.取出添加的用户id值 用于添加用户公司及角色
		
		
		if(resutPassword==1){//重置密码
			Map upmap =new HashMap();
			upmap.put("Userid", userid);
			upmap.put("Password", MD5Encryption.toMD5("aaaaaa"));
			int resetnum  = resetUserPassword(upmap);
			if(resetnum==1){
				savelog("密码重置成功");
			}else{
				savelog("密码重置失败");
			}
		}
		
		
		
		
		//若为编辑数据 先删除之前添加的公司角色
		Map delectmap = new HashMap();
		delectmap.put("table", "User_Company");
		delectmap.put("value", userid);
		delectmap.put("zmd", "Userid");
		deleteUsers(delectmap);
		Map delectmap1 = new HashMap();
		delectmap1.put("table", "User_Role");
		delectmap1.put("value", userid);
		delectmap1.put("zmd", "Userid");
		deleteUsers(delectmap1);
		Map delectmap2 = new HashMap();
		delectmap2.put("table", "User_Department");
		delectmap2.put("value", userid);
		delectmap2.put("zmd", "Userid");
		deleteUsers(delectmap2);
	
		//3.添加用户公司数据
		String[]comids=comid.split(",");
		for(int i=0; i<comids.length;i++){
			String zdm3 ="\"Userid\",\"Comid\"";
			String nr3  =" '"+userid+"','"+comids[i]+"'";
			Map map3 = new HashMap();
			map3.put("table","\"User_Company\"");
			map3.put("zdm", zdm3);
			map3.put("nr", nr3);
			inserttable(map3);
		}
		
		if(deptid!=0) {
			Map mapdep = new HashMap();
			mapdep.put("table","\"User_Department\"");
			mapdep.put("zdm", "\"Userid\",\"Deptid\"");
			mapdep.put("nr", userid+","+deptid);
			inserttable(mapdep);	
			
		}
		
		
		//4.添加用户角色数据
		String[]roleids=roleid.split(",");
		for(int i=0;i<roleids.length;i++){
			String zdm4 ="\"Userid\",\"Roleid\",\"Createuserid\",\"Xguserid\"";
			String nr4  =" '"+userid+"','"+roleids[i]+"','"+createuserid+"','"+createuserid+"'";
			Map map4 = new HashMap();
			map4.put("table","\"User_Role\"");
			map4.put("zdm", zdm4);
			map4.put("nr", nr4);
			inserttable(map4);
		}
		
		
		//5.启用默认角色  通过默认角色id找到对应公司并开启
		List<Company> mrcomids = selectComidByRoleid(mrrole);
		int[] mrcomid=new int[mrcomids.size()];
		int mrcid = 0;
		for(int i=0;i<mrcomids.size();i++){
			mrcomid[i]=mrcomids.get(i).getComid();
		}
		if(mrcomid.length>1){//当默认选中角色有多个对应公司时
			for(int i=0;i<mrcomid.length;i++){
				for(int a=0;a<comids.length;a++){
					if((String.valueOf(mrcomid[i])).equals(comids[a])){
						mrcid = mrcomid[i];
					}    
				}
			}
		}else{
			mrcid = mrcomid[0];
		}
		Map map5 = new HashMap();
		map5.put("Userid",userid);
		map5.put("Roleid", mrrole);
		map5.put("Comid", mrcid);
		int result1 = updateuserrolechecked(map5);
		int result2 = updateusercompanychecked(map5);
		if(password!=null){
			if(result1!=0&&result2!=0){
				message ="用户新增成功" ;
			}
			savelog(message);
		}else{
			if(result1!=0&&result2!=0){
				message ="用户编辑成功" ;
			}
			savelog(message);
		}
		
		ajaxJson(message);
	}


	
	@SuppressWarnings({ "unchecked", "rawtypes" })
	public void yzusercode(){
		List<User> iscode;
		Map map = new HashMap();
		map.put("Usercode", usercode);
		iscode = selectusercode(map);
		if(!isListEmpty(iscode)){
			message="1";
		}else{
			message="0";
		}
		
		jsonWriter(message);
	}
	
	//删除用户
	@SuppressWarnings({ "unchecked", "rawtypes" })
	public void delectuser(){
		if(userid==null) {
			message="参数丢失";
			ajaxJson(message);
			savelog("参数丢失");
			return;
		}
		User loginuser = (User)session.get(Constants.USER);
		if(loginuser==null){
			message="账号超时请重新登录再删除";
			ajaxJson(message);
			return;
		}
		String [] userids = userid.split(",");
		for(int i=0;i<userids.length;i++){
			//2.删除用户公司表
			Map map1 = new HashMap();
			map1.put("table", "User_Company");
			map1.put("value", userids[i]);
			map1.put("zmd", "Userid");
			deleteUsers(map1);
			//3.删除用户角色表
			Map map2 = new HashMap();
			map2.put("table", "User_Role");
			map2.put("value", userids[i]);
			map2.put("zmd", "Userid");
			deleteUsers(map2);
			//3.删除用户菜单权限表
			Map map4 = new HashMap();
			map4.put("table", "User_Menu_Limit");
			map4.put("value", userids[i]);
			map4.put("zmd", "Userid");
			deleteUsers(map4);
			//3.删除用户部门表
			Map map3 = new HashMap();
			map3.put("table", "User_Department");
			map3.put("value", userids[i]);
			map3.put("zmd", "Userid");
			deleteUsers(map3);
			
			Map map5 = new HashMap();
			map5.put("table", "Loginformation");
			map5.put("value", userids[i]);
			map5.put("zmd", "Createuserid");
			deleteUsers(map5);
			//1.删除用户表
			Map map6 = new HashMap();
			map6.put("table", "User");
			map6.put("value", userids[i]);
			map6.put("zmd", "Userid");
			deleteUsers(map6);
			
		}
		message = "删除用户成功!";
		savelog(message);
		ajaxJson(message);
		
	}
	
	//编辑用户表单
	@SuppressWarnings({ "unchecked", "rawtypes" })
	public void usersmod(){
		if(Xgzd.equals("Usercode")){//编辑用户账号时
			List<User> iscode;
			Map map = new HashMap();
			map.put("Usercode",Value);
			map.put("Userid", userid);
			iscode = selectusercode(map);
			if(!isListEmpty(iscode)){
				message="您修改的账号已存在!";
				savelog("修改账号重复");
			}else{
				int result = updateusercode(map);
				if(result==1){
					message="修改成功!";
					savelog("账号修改成功");
				}else{
					message="修改失败!";
					savelog("账号修改失败");
				}
			}
		}else if(Xgzd.equals("Username")){//编辑用户姓名时
			List<User> iscode1;
			Map map1 = new HashMap();
			map1.put("Username",Value);
			map1.put("Userid",userid);
			iscode1 = selectusername(map1);
			if(!isListEmpty(iscode1)){
				message="您修改的用户名已存在!";
				savelog("修改用户名重复");
			}else{
				int result1=updateusername(map1);
				if(result1==1){
					message="修改成功!";
					savelog("用户名修改成功");
				}else{
					message="修改失败!";
					savelog("用户名修改失败");
				}
				
			}
		}else if(Xgzd.equals("Password")) {
			Map upmap =new HashMap();
			upmap.put("table", "\"User\"");
			upmap.put("Value", MD5Encryption.toMD5(Value));
			upmap.put("Xgzd", Xgzd);
			upmap.put("Keyidvalue", Integer.parseInt(userid) );
			upmap.put("Keyid", "Userid");
			updatetablebykey(upmap);
			message="用户密码重置成功";
			savelog("用户密码重置成功");
		}
		ajaxJson(message);
	}
	
	
	
	//用户停启用
	@SuppressWarnings({ "unchecked", "rawtypes" })
	public void ONandOFF(){
		Map map = new HashMap();
		map.put("Forbidden", forbidden);
		map.put("Userid", userid);
		int result = updateForbidden(map);
		if(result==1){
			message="切换成功!";
			if(forbidden.equals(1)){
				savelog("用户启用成功");
			}else{
				savelog(message);
			}
		}else{
			message="切换失败!";
			savelog("用户状态切换失败");
		}
		jsonWriter(message);
	}
	
	
	//用户编辑页 获得已选公司及角色
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public void getcr(){
		Map map = new HashMap();
		map.put("Userid", userid);
		List list= selectOwnCompany(map);
		ajaxJson(list);
	}
	
	//用户编辑页 获得已选公司及角色
		@SuppressWarnings({ "rawtypes", "unchecked" })
		public void getr(){
			Map map = new HashMap();
			map.put("Userid", userid);
			List list= selectOwnRole(map);
			ajaxJson(list);
		}
	
	/*//用户导入上传
	@SuppressWarnings({ "unchecked", "rawtypes" })
	public void upload(){
		String zdm="  \"Username\",\"Usercode\",\"Password\"";
		String nr ="'"+username+"','"+usercode+"','"+password+"'";
		Map map = new HashMap();
		map.put("table", "\"User\"");
		map.put("zdm", zdm);
		map.put("nr",nr);
		inserttable(map);//新增用户
		
		Map mp = new HashMap();
		mp.put("Usercode",usercode);
		String usid = selectUseridByUsercode(mp);//查询新增用户的id
		
		
		//新增用户角色
		String zdm1="  \"Userid\",\"Roleid\",\"Createuserid\",\"Xguserid\"";
		String nr1 ="'"+usid+"','"+roleid+"','"+createuserid+"','"+createuserid+"'";
		Map map1 = new HashMap();
		map1.put("table", "\"User_Role\"");
		map1.put("zdm", zdm1);
		map1.put("nr", nr1);
		inserttable(map1);
		
		//新增用户部门
		String zdm2="  \"Userid\",\"Deptid\"";
		String nr2 ="'"+usid+"','"+deptid+"'";
		Map map2 = new HashMap();
		map2.put("table", "\"User_Department\"");
		map2.put("zdm", zdm2);
		map2.put("nr", nr2);
		inserttable(map2);
		
		
		
		//通过部门id查询新增用户所在公司
		Map mp1 = new HashMap();
		mp1.put("Usercode",deptid);
		String coid  =  selectComidByDeptid(mp1);
		
		//新增用户公司
		String zdm3="  \"Userid\",\"Comid\"";
		String nr3 ="'"+usid+"','"+comid+"'";
		Map map3 = new HashMap();
		map3.put("table", "\"User_Company\"");
		map3.put("zdm", zdm3);
		map3.put("nr", nr3);
		inserttable(map3);
		
		message="1";
		ajaxJson(message);
		savelog("用户id"+usercode+"上传成功!");
	}*/
	
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public void userdaoru(){
		User loginuser = (User)session.get(Constants.USER);
		Company com = (Company)session.get(Constants.USER_COMPANYS);
		String  messages  ="";
		try{
			JSONArray ja = new JSONArray(array);
			for(int i = 0; i < ja.length(); i++){
				JSONObject jo = ja.getJSONObject(i);
				
				boolean iff = true;
				message="第"+(i+1)+"行数据";
				if(jo.getString("Username").equals("")){
					message+= ",用户姓名为空";
					iff=false;
				}
				if(jo.getString("Usercode").equals("")){
					message+= ",用户账号为空";
					iff=false;
				}
				if(jo.getString("Password").equals("")){
					message+= ",用户密码为空";
					iff=false;
				}
				if(jo.getString("Deptid").equals("")){
					message+= ",用户部门为空";
					iff=false;
				}
				if(jo.getString("Roleid").equals("")){
					message+= ",用户角色为空";
					iff=false;
				}
				
				username=jo.getString("Username");
				usercode=jo.getString("Usercode");
				password=MD5Encryption.toMD5(jo.getString("Password"));
				deptid=jo.getInt("Deptid");
				roleid=jo.getString("Roleid");
				int cid=loginuser.getUserid();
				
				//判断用户姓名/账号是否重复
				Map namemap = new HashMap();
				namemap.put("Username", username);
				Map codemap = new HashMap();
				codemap.put("Usercode", usercode);
				List<User> result1 = selectusername(namemap);
				List<User> result2 = selectusercode(codemap);
				if((result1.size())!=0){
					message+= ",用户姓名重复";
					iff=false;
				}
				if((result2.size())!=0){
					message+= ",用户账号重复";
					iff=false;
				}
				
				
				
				
				//查询部门是否存在
				Map deptmap = new HashMap();
				deptmap.put("Deptid",deptid);
				deptmap.put("Comid", com.getComid());
				List<User> result3= selectDeptid(deptmap);
				//查询角色是否存在
				Map rolemap = new HashMap();
				rolemap.put("Roleid", roleid);
				rolemap.put("Comid", com.getComid());
				List<Role> result4 = selectRoleid(rolemap);
				if(isListEmpty(result3)){
					message+= ",用户部门不存在";
					iff=false;
				}
				if(isListEmpty(result4)){
					message+= ",用户角色不存在";
					iff=false;
				}
				
				
				if(iff){
				//添加用户信息
				Map map = new HashMap();
				String zdm="  \"Username\",\"Usercode\",\"Password\"";
				String nr ="'"+username+"','"+usercode+"','"+password+"'";
				map.put("table", "\"User\"");
				map.put("zdm", zdm);
				map.put("nr",nr);
				inserttable(map);
				
				Map mp = new HashMap();
				mp.put("Usercode",usercode);
				String usid = selectUseridByUsercode(mp);//查询新增用户的id
				
				Map commp = new HashMap();
				commp.put("Userid", cid);
				//List<Company> comids =selectComidByUserid(commp);//查询创建公司id
				int coid = com.getComid();
				
				
				
				//新增用户角色
				String zdm1="  \"Userid\",\"Roleid\",\"Createuserid\",\"Xguserid\"";
				String nr1 ="'"+usid+"','"+roleid+"','"+cid+"','"+cid+"'";
				Map map1 = new HashMap();
				map1.put("table", "\"User_Role\"");
				map1.put("zdm", zdm1);
				map1.put("nr", nr1);
				inserttable(map1);
				
				//新增用户部门
				String zdm2="  \"Userid\",\"Deptid\"";
				String nr2 ="'"+usid+"','"+deptid+"'";
				Map map2 = new HashMap();
				map2.put("table", "\"User_Department\"");
				map2.put("zdm", zdm2);
				map2.put("nr", nr2);
				inserttable(map2);
				
				//新增用户公司
				String zdm3="  \"Userid\",\"Comid\"";
				String nr3 ="'"+usid+"','"+coid+"'";
				Map map3 = new HashMap();
				map3.put("table", "\"User_Company\"");
				map3.put("zdm", zdm3);
				map3.put("nr", nr3);
				inserttable(map3);
				
				}else{
					messages+=message;
				}
				
			}
			 
		} catch (JSONException e){
			savelog("上传失败");
		}
		
			if(messages.equals("")){
				message="数据上传成功";
				savelog("上传成功");
			}else{
				message=messages;
				savelog("上传失败"+messages);
			}
			ajaxJson(message);
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
	/*@SuppressWarnings({  "rawtypes", "unchecked" })
	public String  dodaoru(File file) {
		String xlsPath=file.getPath();
		User loginuser = (User)session.get(Constants.USER);
		 SqlSession sqlSession = getSqlSession(); 
		 UserMapper mapper=sqlSession.getMapper(UserMapper.class);	
		 Map pharm=new HashMap();
		 pharm.put("Status", 5);
		 pharm.put("Createuserid", loginuser.getUserid());	
		try {	
			 FileInputStream fileIn = new FileInputStream(xlsPath);
				//根据指定的文件输入流导入Excel从而产生Workbook对象
			Workbook wb0 = new HSSFWorkbook(fileIn);
				//获取Excel文档中的第一个表单
			 Sheet sht0 = wb0.getSheetAt(0); 
			 int t=sht0.getLastRowNum()+1;	 
			 if(t<=1) {
					message="上传的文件无数据！";	
					fileIn.close();
					sqlSession.close();
					return message;	
				}
			 String	bt =sht0.getRow(0).getCell(0).getStringCellValue();
			 if(!bt.equals("姓名")) {
				  message="文件有误,请选择正确的导入文件！"; 
				  fileIn.close();
					 sqlSession.close();
				 return message;
			  }
			 int a=1;
			 String name="";
			 Row m=sht0.getRow(0);
				int lastcell=m.getLastCellNum();
				
			
			 for(int l=1;l<t;l++) {
				 user=new User();
				 user.setComid(loginuser.getComid());
				 user.setCreateuserid(loginuser.getUserid());
				 Row r=sht0.getRow(l);
				 for(int c = 0;c<lastcell;c++) {
				if(r.getCell(c)!=null) {
					 HSSFCell content_tel_name2 = (HSSFCell) r.getCell(c);
					 content_tel_name2.setCellType(HSSFCell.CELL_TYPE_STRING);
					 	
				}else {
				r.createCell(c).setCellValue("");		
					
				}
					 
				}
				 if(r.getCell(0).getStringCellValue().replaceAll(" ", "")=="") {
					 message="第"+l+"行姓名为空！导入失败！"; 
					 
					 fileIn.close();
					 sqlSession.close();
					 return message;
					 
				 }else {
					 if(name.indexOf(r.getCell(0).getStringCellValue().replaceAll(" ", ""))>-1) {
						 message="第"+l+"行姓名重复！导入失败！"; 
						 fileIn.close();
						 sqlSession.close();
						 return message;
					 }else {
						 
						 name=name+r.getCell(0).getStringCellValue().replaceAll(" ", "");
						 user.setUsername(r.getCell(0).getStringCellValue().replaceAll(" ", "")); 
						  
					 }
					 
					 
				 }
				 
				 if(r.getCell(1).getStringCellValue().replaceAll(" ", "")=="") {
					 message="第"+l+"行账号为空！导入失败！"; 
					 
					 
					 fileIn.close();
					 sqlSession.close();
					 return message;
					 
				 }else {
					 if(name.indexOf(r.getCell(1).getStringCellValue().replaceAll(" ", ""))>-1) {
						 message="第"+l+"行账号重复！导入失败！"; 
							
						 fileIn.close();
						 sqlSession.close();
						 return message;
					 }else {
						 
						 usercode=usercode+r.getCell(0).getStringCellValue().replaceAll(" ", "");
						 user.setUsercode(r.getCell(0).getStringCellValue().replaceAll(" ", "")); 
						  
					 }
					 
					 
				 }
				 
				 if(r.getCell(2).getStringCellValue().replaceAll(" ", "")=="") {
				
                     message="第"+l+"行密码为空！导入失败！"; 
					 
					 fileIn.close();
					 sqlSession.close();
					 return message;
				 }
					 if(r.getCell(3).getStringCellValue()=="") {
							
	                     message="第"+l+"行部门ID为空！导入失败！";
						 
						 fileIn.close();
						 sqlSession.close();
						 return message;
					 }
					 
					 if(r.getCell(4).getStringCellValue()=="") {
							
	                     message="第"+l+"行角色ID为空！导入失败！"; 
						 
						 fileIn.close();
						 sqlSession.close();
						 return message;
					 }
					 
					 
					 
					 
					
					 ygxx.setTjinformation(r.getCell(11).getStringCellValue());
					 ygxx.setBeizhu(r.getCell(12).getStringCellValue());
					 ygxx.setStatus(5);//导入标记
					 ygxx.setYgid(r.getRowNum());
					 a*=ygmapper.insertdryg(ygxx);
					 if(a==0) {
                         message="系统异常！导入失败！"; 
                         ygmapper.deletedrry(pharm);
						 
						 fileIn.close();
						 sqlSession.close();
						 return message; 
					 }
					 }
				 	     
				 
			 
		message=successpldrry(pharm);
		ygmapper.deletedrry(pharm);
			 }	 
			 
        }catch(Exception e){
			 
			 message="文件格式异常,请检查文件是否被加密或者内容格式是否正确。错误："+e; 
			 ygmapper.deletedrry(pharm);
			 
		}
		 
		sqlSession.close();
		return message;
	
	}*/
	
	
	/*public String successpldrry(@SuppressWarnings("rawtypes") Map pharm) {
		SqlSession sqlSession = getSqlSession();
		try {
			 UserMapper mapper=sqlSession.getMapper(UserMapper.class);	
			 userlist=mapper.selectnameby(pharm);
			 if(yglist.size()==0) {
				 ygmapper.insertdrxx(pharm);	 
				 message="导入成功！";
			 }else {
				 message="行号为:";
		     for(int n=0;n<yglist.size();n++) {
		    	 message+=yglist.get(n).getYgid()+",";
		    	 
		     }		 
		     message+="姓名重复请检查！"; 
			 
			 }
		
		}finally {
				sqlSession.close();
			}
			return message;
	}*/
	
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	

	public String getUsercode() {
		return usercode;
	}

	public void setUsercode(String usercode) {
		this.usercode = usercode;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getNewpassword() {
		return newpassword;
	}

	public void setNewpassword(String newpassword) {
		this.newpassword = newpassword;
	}

	public int getPage() {
		return page;
	}

	public void setPage(int page) {
		this.page = page;
	}

	public int getLimit() {
		return limit;
	}

	public void setLimit(int limit) {
		this.limit = limit;
	}


	public String getRoleid() {
		return roleid;
	}


	public void setRoleid(String roleid) {
		this.roleid = roleid;
	}

	public String getForbidden() {
		return forbidden;
	}

	public void setForbidden(String forbidden) {
		this.forbidden = forbidden;
	}

	public List<User> getUsers() {
		return users;
	}

	public void setUsers(List<User> users) {
		this.users = users;
	}

	public String getComid() {
		return comid;
	}

	public void setComid(String comid) {
		this.comid = comid;
	}

	public String getMrrole() {
		return mrrole;
	}

	public void setMrrole(String mrrole) {
		this.mrrole = mrrole;
	}

	public String getCreateuserid() {
		return createuserid;
	}

	public void setCreateuserid(String createuserid) {
		this.createuserid = createuserid;
	}

	public String getUserid() {
		return userid;
	}

	public void setUserid(String userid) {
		this.userid = userid;
	}

	public String getXgzd() {
		return Xgzd;
	}

	public void setXgzd(String xgzd) {
		Xgzd = xgzd;
	}

	public String getValue() {
		return Value;
	}

	public void setValue(String value) {
		Value = value;
	}

	public int getResutPassword() {
		return resutPassword;
	}

	public void setResutPassword(int resutPassword) {
		this.resutPassword = resutPassword;
	}


	public List<Company> getComs() {
		return coms;
	}


	public void setComs(List<Company> coms) {
		this.coms = coms;
	}


	public List<Role> getRoles() {
		return roles;
	}


	public void setRoles(List<Role> roles) {
		this.roles = roles;
	}

	

	


	public String getComids() {
		return Comids;
	}


	public void setComids(String comids) {
		Comids = comids;
	}


	public String getRoleids() {
		return Roleids;
	}


	public void setRoleids(String roleids) {
		Roleids = roleids;
	}


	public int getType() {
		return Type;
	}


	public void setType(int type) {
		Type = type;
	}


	public int getMenuid() {
		return menuid;
	}


	public void setMenuid(int menuid) {
		this.menuid = menuid;
	}


	public String getLimits() {
		return limits;
	}


	public void setLimits(String limits) {
		this.limits = limits;
	}


	public File getFile() {
		return file;
	}


	public void setFile(File file) {
		this.file = file;
	}


	public String getArray() {
		return array;
	}


	public void setArray(String array) {
		this.array = array;
	}


	public int getRoleID() {
		return RoleID;
	}


	public void setRoleID(int roleID) {
		RoleID = roleID;
	}


	public String getUserids() {
		return userids;
	}


	public void setUserids(String userids) {
		this.userids = userids;
	}


	public int getForbi() {
		return Forbi;
	}


	public void setForbi(int forbi) {
		Forbi = forbi;
	}


	public int getUserId() {
		return UserId;
	}


	public void setUserId(int userId) {
		UserId = userId;
	}


	public List<Zhsq> getZhsqs() {
		return zhsqs;
	}


	public void setZhsqs(List<Zhsq> zhsqs) {
		this.zhsqs = zhsqs;
	}


	public int getXzwjlx() {
		return xzwjlx;
	}


	public void setXzwjlx(int xzwjlx) {
		this.xzwjlx = xzwjlx;
	}


	public int getId() {
		return id;
	}


	public void setId(int id) {
		this.id = id;
	}


	public int getJg() {
		return jg;
	}


	public void setJg(int jg) {
		this.jg = jg;
	}


	public String getEmail() {
		return email;
	}


	public void setEmail(String email) {
		this.email = email;
	}

	
	
	

	
	
}